#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Mikan CSS ビュー 機能

Mikan Python Web Framework
"""

__author__ = "K.Sonohara"
__status__ = "develop"
__version__ = "0.0.0_c"
__date__    = "2013/03/31"
__license__ = 'LGPL'

# ------------------------------------------------------------
## インポート
# ------------------------------------------------------------
# Python
import os

# ESiPC
from esipc.css.inicss import ESiPCINICSS

# Mikan
from mikan.view import MikanTextView

# ESiPC
from esipc import ESiPCProperty

# ------------------------------------------------------------
## 変数
# ------------------------------------------------------------

# ------------------------------------------------------------
## 関数
# ------------------------------------------------------------

# ------------------------------------------------------------

# ------------------------------------------------------------
## クラス
# ------------------------------------------------------------

# ------------------------------------------------------------
## Mikan エラー アプリケーション クラス
class MikanCSSView(MikanTextView):

	def get_csss(self):
		return self.FCSSs

	def __init__(self, r, cssname="css"):
		super(MikanCSSView, self).__init__(r)

		self.FCSSName = cssname
		self.FCSSs = ESiPCINICSS()

	def get_content_type(self):
		return "text/css"

	def get_content(self):
		return str(self.csss.to_csss())

	def get_css_name(self):
		return self.FCSSName

	def set_css_name(self, value):
		self.FCSSName = value

	def perform(self):
		bp = os.path.join(self.request.mikanroot, "etc")
		bp = os.path.join(bp, "css")
		bp = os.path.join(bp, self.cssname)

		self.csss.load_inis(u"%s.%s.ini" % (bp, "%s"))

		return True

	# ----------------------------------------------------
	## Property
	csss = ESiPCProperty(get_csss, set_css_name, None)
	cssname = ESiPCProperty(get_css_name, set_css_name, None)

# ------------------------------------------------------------
## メイン関数
# ------------------------------------------------------------
if __name__ == '__main__':
	pass

# ------------------------------------------------------------
